<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv=Content-Type content="text/html; charset=utf-8">
    <title>消息中心 - 小乖乖问答系统</title>
    <link rel="icon" href="/favicon.ico">
    <link rel="stylesheet" href="/css/publish.css">
    <link rel="stylesheet" href="/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="/css/bootstrap-theme.min.css"/>
    <script src="/js/jquery-3.4.1.js" type="application/javascript"></script>
    <script src="/js/bootstrap.min.js" type="application/javascript"></script>
</head>
<body class="main-img">
<nav th:insert="~{common/head :: comment_header}"></nav>
<div class="container-fluid main">
    <div class="row">
        <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12">
            <h2>
                [[${sectionName}]]
            </h2>
            <hr/>
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" th:if="${section == 'questions'}">
                <div class="media" th:each="dto : ${pageDto.dtoList}">
                    <div class="media-left">
                        <a href="#">
                            <img width="50px" height="50px" class="media-object img-thumbnail"
                                 th:src="@{${dto.user.avatarUrl}}" onerror="this.src='/images/IMG_0044.jpg';">
                        </a>
                    </div>
                    <div class="media-body">
                        <h4 class="media-heading">
                            <a th:href="@{'/question/'+${dto.question.id}}" aria-label="questionTitle"
                               th:text="${dto.question.questionTitle}" style="text-decoration: none;"></a>
                        </h4>
                        <!--                        <span th:text="${dto.question.description}"></span>-->
                        <!--                        <br />-->
                        <span class="text-desc">
                           <span th:text="${dto.question.commentCount}"></span>&nbsp;个回复
                           &nbsp; • <span th:text="${dto.question.viewCount}"></span>&nbsp;次浏览
                           &nbsp; • <span th:text="${#dates.format(dto.question.gmtCreate, 'yyyy-MM-dd HH:mm:ss')}">1个小时前</span>
                             <a th:if="${session.user != null && session.user.id eq dto.user.id}"
                                th:href="@{'/publish/'+${dto.question.id}}" class="amenu"
                                style="text-decoration: none;margin-left: 8px;">
                                <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                                    编辑
                            </a>
                        </span>
                    </div>
                    <hr/>
                </div>
                <nav aria-label="Page navigation navbar-fixed-bottom"
                     style="margin-top: -28.5px;height: 66px;margin-bottom: -20px;">
                    <ul class="pagination">
                        <li th:if="${pageDto.showFirstPage}">
                            <a th:href="@{'/profile/'+${section}(page=1)}" aria-label="FirstPage">
                                <span aria-hidden="true">&laquo;</span>
                            </a>
                        </li>
                        <li th:if="${pageDto.showPrevious}">
                            <a th:href="@{'/profile/'+${section}(page=${page-1})}" aria-label="Previous">
                                <span> &lt; </span>
                            </a>
                        </li>

                        <li th:each="pages : ${pageDto.pages}" th:class="${pages == page}? 'active' : ''">
                            <a th:href="@{'/profile/'+${section}(page=${pages})}">
                                [[${pages}]]
                            </a>
                        </li>

                        <li th:if="${pageDto.showNet}">
                            <a th:href="@{'/profile/'+${section}(page=${page}+1)}" aria-label="Next">
                                <span> &gt; </span>
                            </a>
                        </li>
                        <li th:if="${pageDto.showEndPage}">
                            <a th:href="@{'/profile/'+${section}(page=${pageDto.totalPage})}" aria-label="EndPage">
                                <span aria-hidden="true">&raquo;</span>
                            </a>
                        </li>
                    </ul>
                </nav>
                <hr style="margin-bottom: 0px !important;"/>
            </div>
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" th:if="${section == 'replies'}">
                <div class="media" th:each="dto : ${pageDto.dtoList}">
                    <div class="media-body">
                        <h5 class="media-heading">
                            <a style="text-decoration: none;" th:text="${dto.notifierName}"></a>
                            <span th:text="${dto.typeName}"></span>
                            <a style="text-decoration: none;" th:href="@{'/notification/'+${dto.id}}" th:text="${dto.outerTitle}">

                            </a>
                            <span class="label label-danger"  th:if="${dto.status != 1}">未读</span>
                            <span class="pull-right" th:text="${#dates.format(dto.gmtCreate, 'yyyy-MM-dd HH:mm:ss')}"></span>
                        </h5>
                    </div>
                    <hr />
                </div>
                <nav aria-label="Page navigation navbar-fixed-bottom"
                     style="margin-top: -28.5px;height: 66px;margin-bottom: -20px;">
                    <ul class="pagination">
                        <li th:if="${pageDto.showFirstPage}">
                            <a th:href="@{'/profile/'+${section}(page=1)}" aria-label="FirstPage">
                                <span aria-hidden="true">&laquo;</span>
                            </a>
                        </li>
                        <li th:if="${pageDto.showPrevious}">
                            <a th:href="@{'/profile/'+${section}(page=${page-1})}" aria-label="Previous">
                                <span> &lt; </span>
                            </a>
                        </li>

                        <li th:each="pages : ${pageDto.pages}" th:class="${pages == page}? 'active' : ''">
                            <a th:href="@{'/profile/'+${section}(page=${pages})}">
                                [[${pages}]]
                            </a>
                        </li>

                        <li th:if="${pageDto.showNet}">
                            <a th:href="@{'/profile/'+${section}(page=${page}+1)}" aria-label="Next">
                                <span> &gt; </span>
                            </a>
                        </li>
                        <li th:if="${pageDto.showEndPage}">
                            <a th:href="@{'/profile/'+${section}(page=${pageDto.totalPage})}" aria-label="EndPage">
                                <span aria-hidden="true">&raquo;</span>
                            </a>
                        </li>
                    </ul>
                </nav>
                <hr style="margin-bottom: 0px !important;"/>
            </div>
        </div>

        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
            <div class="list-group" style="margin-top: 20px;">
                <a href="/profile/questions"
                   th:class="${section == 'questions'}? 'list-group-item active' : 'list-group-item'">
                    我的提问
                </a>
                <a href="/profile/replies"
                   th:class="${section == 'replies'}? 'list-group-item active' : 'list-group-item'">
                    最新回复
                    <span class="badge" th:text="${session.unReadCount}">4</span>
                </a>
            </div>

        </div>
    </div>
</div>
<nav th:insert="~{common/footer :: comment_footer}"></nav>
</body>
</html>